home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
RMTC02.ARJ
/
WRITEDEF.C
< prev
next >
Wrap
Text File
|
1992-04-06
|
743b
|
47 lines
#include <stdio.h>
#include <alloc.h>
#include <graphics.h>
void main()
{
FILE *F;
int driver = EGA;
int mode = EGAHI;
int x, y, x2, y2, i, j;
int col;
initgraph(&driver, &mode, "");
setfillstyle(SOLID_FILL,BLUE);
bar(0,0,639,349);
setfillstyle(HATCH_FILL,GREEN);
bar(0,0,30,30);
setfillstyle(SOLID_FILL,LIGHTRED);
bar(20,20,40,40);
x=0;
y=0;
x2=40;
y2=40;
if ((F=fopen("sample.def","w")) == NULL)
{
closegraph();
printf("Can't open file!\n");
exit(0);
}
for (j=y;j<y2+1;j++)
{
for (i=x;i<x2+1;i++)
{
col=getpixel(i,j);
fprintf(F,"%X",col);
}
fprintf(F,"\n");
}
fclose(F);
getch();
closegraph();
}